package net.comm.check.db;


import java.sql.ResultSet;
import java.sql.SQLException;


import net.comm.check.bean.BaseJifen;
import net.comm.util.StringUtil;

import org.apache.log4j.Logger;
import org.sakaiproject.db.api.SqlReader;

public class DbJifenService implements SqlReader
{

	static Logger logger = Logger.getLogger(DbJifenService.class.getName());

	/**
	 * Read from the result one set of fields to create a Resource.
	 * 
	 * @param result
	 *        The Sql query result.
	 * @return The Resource object.
	 */
	public Object readSqlResultRecord(ResultSet result)
	{
		try
		{		
			
			int fnID = result.getInt(1);		//	功能ID
			String fname = StringUtil.getValue(result.getString(2));	//	功能名称
			int jifen = result.getInt(3);		//	积分		

			// create the Resource from these fields
			return new BaseJifen( fnID, fname,  jifen);
		}
		catch (SQLException e)
		{
			logger.error("读取表数据持久层失败！");
			return null;
		}
		
	}
}
